import { http } from "@/utils/http";
import axios from "axios";
// type Result = {
//   code: [string, number];
//   mesage: string;
//   data: Array<any>;
// };
/** sql解析 */
export const sqlParse = (data?: object) => {
  return http.post("/tools-api/api/parse_sql", { data });
};

/** AI生成结构图 */
export const generateModuleStructure = (data?: object) => {
  return http.get("/tools-api/api/generateModuleStructure", { params:data });
};



export const generateWord = (payload: { sql: string; tableType?: "normal" | "threeline" }) => {
  return http.post(
    "/tools-api/api/generate_word",
    payload, 
    {
      responseType: "arraybuffer",
      headers: {
        "Content-Type": "application/json",
        "Accept": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      },
      transformResponse: [(d: any) => d],
      validateStatus: () => true,
    }
  );
};





